import request from '@/utils/request'

export function getBillList(params = {}) {
    return request({
        url: '/getBillList',
        method: 'get',
        params
    })
}

export function getAhCompanyList(params = {}) {
    return request({
        url: "/getAhCompanyList",
        method: "get",
        params
    })
}

export function pauseOrder(data = {}) {
    return request({
        url: '/pauseOrder',
        method: 'post',
        data
    })
}

//获取详细运单
export function waybillTracking(data) {
    return request({
        url: '/waybillTracking',
        method: 'get',
        params: data
    })
}

//获取分运单详情
export function waybillDetails(data) {
    return request({
        url: '/waybillDetails',
        method: 'get',
        params: data
    })
}
//核对运单
export function verifyWaybill(data) {
    return request({
        url: '/verifyWaybill',
        method: 'post',
        data
    })
}

//查看回单
export function viewReceipts(data) {
    return request({
        url: '/viewReceipts',
        method: 'get',
        params: data
    })
}

//保存回单

export function updateViewReceipts(data) {
    return request({
        url: '/updateViewReceipts',
        method: 'post',
        data
    })
}

//删除总运单
export function deleteMainBill(data) {
    return request({
        url: '/deleteMainBill',
        method: 'post',
        data
    })
}

//全部运单追踪
export function getOwnerBillList(data) {
    return request({
        url: '/getBillList',
        method: 'get',
        params: data
    })
}
//司机信息查询
export function getDriverDetail(data) {
    return request({
        url: '/getDriverDetail',
        method: 'get',
        params: data
    })
}

//获取合同链接
export function getContractLink(params = {}) {
    return request({
        url: '/getContractLink',
        method: "get",
        params
    })
}
//删除分运单
export function deleteSubBill(data = {}) {
    return request({
        url: "/deleteSubBill",
        method: "post",
        data
    })
}

export function getSubBillList(params = {}) {
    return request({
        url: "/getSubBillList",
        method: "get",
        params
    })
}

/**
 * 批量核对运单
 * @param {id} data 逗号分隔
 * @returns 
 */
export function updateBillStatus(data = {}) {
    return request({
        url: "/updateBillStatus",
        method: 'post',
        data
    })
}


/**
 * 获取运单提货经纬度
 * @param {id} params 运单id
 * @returns 
 */
export function takeGoodsPosition(params = {}) {
    return request({
        url: "/takeGoodsPosition",
        method: 'get',
        params
    })
}


/**
 * 获取司机列表
 * @param keyWord 司机名或号码 
 */
export function getOwnerDriverList(params = {}) {
    return request({
        url: "/getOwnerDriverList",
        method: 'get',
        params
    })
}

/**
 * 指派-通过司机id获取车辆信息
 * @param driver_id 司机id 
 */
export function getOwnerCarList(params = {}) {
    return request({
        url: "/getOwnerCarList",
        method: 'get',
        params
    })
}

/**
 * 指派运单
 * @param add_id 总运单id
 * @param kg 收货重量
 * @param car_id 车辆id
 * @param driver_id 司机id
 * **/
export function assignDriverBill(data = {}) {
    return request({
        url: "/assignDriverBill",
        method: "post",
        data
    })
}

//异常运单
export function getSubBillListError(data) {
    return request({
        url: '/getSubBillListError',
        method: 'get',
        params: data
    })
}

/**
 * 恢复异常运单
 * @param th_time 提货时间
 * @param dd_time 提货时间
 * @param id 自增id
 * **/
export function updateErrorBill(data = {}) {
    return request({
        url: "/updateErrorBill",
        method: "post",
        data
    })
}


/**
 * 删除异常运单
 * @param id 自增id
 * **/
export function deleteErrorBill(data = {}) {
    return request({
        url: "/deleteErrorBill",
        method: "post",
        data
    })
}


/**
 * 获取运费模版详情
 * @param id 自增id
 * **/
export function freightTemplateDetail(params = {}) {
    return request({
        url: "/freightTemplateDetail",
        method: "get",
        params
    })
}

/**
 * 运单日志
 * @param id 自增id
 * **/
export function getBillLog(params = {}) {
    return request({
        url: "/getBillLog",
        method: "get",
        params
    })
}

/**
 * 保存并提交微信申请
 * @param company 公司名称
 * @param add_id 总运单id
 * @param yund_id 运单id
 * @param money 结算金额
 * @param bill_money 含税金额
 * @param cph 车牌号
 * @param weight 收货重量
 * @param driver_name 司机姓名
 * **/
export function submitApplication(data = {}) {
    return request({
        url: "/submitApplication",
        method: "post",
        data
    })
}

/**
 * 微信模版推送
 * @param batch_number 审批单号
 * **/
export function pushUserWechat(data = {}) {
    return request({
        url: "/pushUserWechat",
        method: "post",
        data
    })
}


/**
 * 获取审批流程详情
 * @param yund_id 运单id
 * **/
export function getApproveBillDetail(params = {}) {
    return request({
        url: "/getApproveBillDetail",
        method: "get",
        params
    })
}


/**
 * 获取角色列表
 * **/
export function getApproveRoleList(params = {}) {
    return request({
        url: "/getApproveRoleList",
        method: "get",
        params
    })
}

/**
 * 微信运单审批列表
 * @param company 公司名称
 * @param yund_id 分运单id
 * @param status 0全部1开单人审批2追踪人员审批3平台部审批4财务部审批5董事长审批
 * @param add_time 申请时间 2023-04-06 - 2023-06-08
 * **/
export function getApproveBillList(params = {}) {
    return request({
        url: "/getApproveBillList",
        method: "get",
        params
    })
}

/**
 * 更新运单发货重量
 * @param sub_id 运单id
 * @param kg 发货重量
 * **/
export function updateShippingWeight(data = {}) {
    return request({
        url: "/updateShippingWeight",
        method: "post",
        data
    })
}

/**
 * 设置载重
 * @param id 运单id
 * @param is_overload 0不允许超载 1允许超载
 * **/
export function setWeightLoad(data = {}) {
    return request({
        url: "/setWeightLoad",
        method: "post",
        data
    })
}

/**
 * 锁定/解锁订单
 * @param is_lock 0未锁定1锁定
 * @param id 运单id
 * **/
export function LockSubWayBill(data = {}) {
    return request({
        url: "/LockSubWayBill",
        method: "post",
        data
    })
}

